package com.pc.controller;

import com.pc.enrty.User;
import com.pc.service.UserService;
import com.pc.util.ResultObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/pc/")
public class UserController {
    @Autowired
    private UserService userService;
    @Autowired
    private ResultObject result;

    /**
     * 登录,传递用户名,uid
     * @return
     */
    @RequestMapping("login")
    public User login(String username, String password){
        User user = userService.login(username,password);
        System.out.println(user);
        return user;
    }

    /**
     * 注册
     * @return
     */
    @RequestMapping("register")
    public boolean register(User user){
        boolean b = userService.register(user);
        return b;
    }
}
